home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Libraries / Copland ResourcesLib / System8ResourcesStatic.cp < prev   
Text File  |  1995-08-24  |  1KB  |  59 lines

  1. /*
  2.     File:        System8ResourcesStatic.cp
  3.  
  4.     Contains:    The System 7 resource manager redefined in
  5.                     terms of the System 8 Resource Manager.
  6.                 Add this file to your project directly.
  7.                 These procedures are _not_ part of the System 8
  8.                 resource manager.
  9.                 
  10.     Written by: Chris Thomas <ckt@best.com>
  11.                     bug reports, suggestions, comments welcome!
  12.                     
  13.     Version:    1.0
  14.     
  15.     Copyright:    © 1995 Chris K. Thomas.  All Rights Reserved.
  16.                 © 1995 Apple Computer, Inc.  All Rights Reserved.
  17.  
  18.     Change History (most recent first):
  19.      
  20.                8/24/95    ckt        Created.
  21. */
  22.  
  23. #include "System8Resources.h"
  24. #include <Errors.h>
  25. #include <Script.h>
  26.  
  27. OSStatus RMFSpCreateResFile(FSSpec *inSpec, OSType creator, OSType fileType, ScriptCode scriptTag)
  28. {
  29.     OSStatus        outErr = 0L;
  30.     
  31.     FSpCreateResFile(inSpec, creator, fileType, scriptTag);
  32.     
  33.     outErr = ResError();
  34.     return outErr;
  35. }
  36.  
  37. // * careful with permissions - note new constants
  38. OSStatus RMFSpOpenResFile(FSSpec *spec, ResFilePermissions permissions, Boolean resLoad, ResFileRefNum *refNum)
  39. {
  40.     OSStatus    outErr = 0L;
  41.     UInt8        saveResLoad;
  42.     
  43.     saveResLoad = LMGetResLoad();
  44.     SetResLoad(resLoad);
  45.     
  46.     if(permissions == kResFileReadOnlyPermission)
  47.         permissions = fsRdPerm;
  48.     else if(permissions == kResFileReadWriteExclusivePermission)
  49.         permissions = fsRdWrPerm;
  50.     else
  51.         return permErr;
  52.     
  53.     *refNum = FSpOpenResFile(spec, (SignedByte)permissions);
  54.     
  55.     outErr = ResError();
  56.     
  57.     SetResLoad(saveResLoad);
  58.     return outErr;
  59. }